<?php
declare (strict_types=1);

namespace app\api\controller;

use app\api\model\Goods;
use think\Request;

class Amoy
{
    public function amoypasswordDo()
    {
        $user_id = input('user_id');
        $goods_id = input('goods_id');
        $goods = Goods::find($goods_id);
        $goods_name = $goods['goods_name'];
        $data = encrypt($goods_name, $user_id);
        return json(['code' => 200, 'msg' => '生成成功', 'data' => $data]);
    }

    public function amoypasswordSolu()
    {
        $code = input('code');

        $user_id = input('user_id');

        $data = decrypt($code, $user_id);

        return json(['code' => 200, 'msg' => '解密成功', 'data' => $data]);
    }
}
